//------------------------------------------------------------------------------
#include "CMyLineEdit.h"
//------------------------------------------------------------------------------
CMyLineEdit::CMyLineEdit(QWidget *parent) : QLineEdit(parent), CChampText()
{
	setDataType(CCommun::edtString);
	setFormule("");
	setEvalTimes(0);
}
//------------------------------------------------------------------------------
QString CMyLineEdit::getValue(void)
{
	QString ret=text().replace("\"", "\\\"");
	return ret;
}
//------------------------------------------------------------------------------
void CMyLineEdit::setValue(QVariant value)
{
	setText(toString(value));
}
//------------------------------------------------------------------------------
void CMyLineEdit::setStateEnable(bool enable)
{
	if(_standaloneEnable)
	{
		setEnabled(enable);
	}
}
//------------------------------------------------------------------------------
void CMyLineEdit::setAttribut(EAttribut value)
{
	QString oldToolTip=toolTip();
	_attribut=value;
	
	setStyleSheet(makeStyleSheet(value, oldToolTip));
	setToolTip(oldToolTip);
}
//------------------------------------------------------------------------------
void CMyLineEdit::setTextCondition(QString value)
{
	_textCondition=value;
	if(getAttribut() & atObligatoireConditionel)
	{
		setToolTip(value);
	}
}
//------------------------------------------------------------------------------
bool CMyLineEdit::isEmpty(void)
{
	return toBool(text());
}
//------------------------------------------------------------------------------
void CMyLineEdit::keyPressEvent(QKeyEvent * event)
{
	if(event->key() == Qt::Key_F1)
	{
		emit inkoveHelp(this);
	}
	QLineEdit::keyPressEvent(event);
}
//------------------------------------------------------------------------------
void CMyLineEdit::mouseReleaseEvent(QMouseEvent *event) {
	if((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
		emit clickWithCtrl();
	}
}
//------------------------------------------------------------------------------

